LassoScript Utility
Basics Browse Detail

[Net->Close]

Tag Link [Net->Close] Category Networking
Type Member Source Available Yes
Support Preferred Version 7.0
Change Unchanged Data Source Any
Output Type None Security None
Implementation LCAPI Sets Lasso 8.5, Lasso 8.0, Lasso 7.0

Description

[Net->Close] closes an open network connection. This tag will close either outgoing or incoming connections. [Net->Close] should be used on each connection when communication is done to ensure that no ports are left open longer than necessary.

Syntax

<?LassoScript
Variable: 'Connection' = (Net);
$Connection->(Connect: 'www.example.com', 80);
...
$Connection->Close;
?>

Parameters

No Parameters Required.

Examples

To connect to a remote server using TCP:

Use the [Net] type and its member tags to establish a TCP connection. The following example opens a blocking TCP connection to the Web server running on an example server and fetches the root document. The result will be an HTML page.

[Variable: 'myConnection' = (Net)]
[$myConnection->(SetBlocking: True)]
[Var: 'Result' = $myConnection->(Connect: 'www.example.com', 80)]
[Fail_If: $Result != Net_ConnectOK, (-1), 'TCP Error']
[Variable: 'Result' = $myConnection->(Write: 'GET / HTTP/1.0\r\n\r\n')]
[Variable: 'Output' = $myConnection->(Read: 32768)]
[$myConnection->(Close)]
[Output: $Output]

<html><head><title>HTML Document</title></head>>body> ...